package com.efounder.message.manager;

import android.os.Handler;
import android.os.Message;

public abstract class JFMessageHandler extends Handler{
    public static final String KEY_DATA = "data";

    public static final int SUCCESS = 0;
    public static final int FAILURE = -1;

    public JFMessageHandler(){
    }

    @Override
    public void handleMessage(Message msg) {
        super.handleMessage(msg);

        switch (msg.what) {
            case SUCCESS:
                handleSuccess(msg);
                break;
            case FAILURE:
                handleFailure(msg.arg1, String.valueOf(msg.obj));
                break;
        }
    }

    public abstract void handleSuccess(Message msg);
    public abstract void handleFailure(int code, String msg);
}
